function GetShellFolder(Common: Boolean; const ID: TShellFolderID): String;
Gets the location of the specified shell folder. Returns the 'common' version of the shell folder location if Common is True and the user has administrative privileges. On failure (unlikely but possible), an empty string is returned.
There is little reason to use this function. It is recommended that you use the ExpandConstant function instead to get the paths of shell folders.
var Path: String; begin Path := GetShellFolder(False, sfAppData); if Path <> '' then begin MsgBox('Application Data path = ' + Path, mbInformation, MB_OK); end else begin // handle failure end; end;